<!--conf
<sample in_favorites="false">
              <product version="1.5" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Storing state in Cookies</title>
</head>

<body>
	<h1>Storing state in Cookies</h1>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
  
	Open state of the tree can be easily saved to cookies. So you can test this functionality by saving the tree state, refreshing the page and restoring the previous state after that.</br>
    The tree can be serialized to XML, you should define the level of data serialization in related checkboxes.
    <table>
		<tr>
			<td>
				<div id="treeboxbox_tree" style="width:260px; height:260px;background-color:#f5f5f5;border :1px solid Silver; "/>
			</td>
			<td valign="top">
			<a href="javascript:void(0)" onClick="tree.saveOpenStates()">Save open state</a><br>
			<a href="javascript:void(0)" onClick="tree.loadOpenStates()">Restore open state</a><br>
			<a href="javascript:void(0)" onClick="tree.setSerializationLevel(document.getElementById('sm1').checked,document.getElementById('sm2').checked);  document.getElementById('zet1').value=tree.serializeTree()">Get tree XML</a> <input id="sm1" type="checkbox"><label for="sm1">User Data</label>&nbsp;&nbsp;<input id="sm2" type="checkbox"><label for="sm2">Details</label><br>
			<textarea id="zet1" style="width:300px; height:200px;"></textarea>
			</td>
		</tr>
	</table>
	<br>


	<script>

			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);


			tree.setSkin('dhx_skyblue');
			tree.setImagePath("../../../codebase/imgs/dhxtree_skyblue/");
			tree.enableDragAndDrop(true);			
			tree.loadXML("../common/tree.xml",function(){tree.loadOpenStates()})
			
			
	</script>
<br><br>

</body>
</html>
